home *** CD-ROM | disk | FTP | other *** search
- /* © 1988-91, Bowers Development Corp. */
- /* Windowing.c */
-
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Controls.h>
- #include <Dialogs.h>
- #include <Events.h>
- #include <Lists.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include "Globals.h"
- #include "Scrolling.h"
- #include "Miscellany.h"
- #include "FileM.h"
- #include "Dispatcher.h"
-
- #include "Windowing.h"
- #ifndef __C14__
- #include "PredatorPrey.h"
- #endif
-
- #include <ToolUtils.h>
- #include <Script.h>
-
- #define topLeft(r) (((Point *) &(r))[0])
- #define botRight(r) (((Point *) &(r))[1])
-
- void WindowingSeg() {}
-
- #pragma segment Windowing
-
-
- /*----------*/
- void DoContent (WindowPtr whichWindow)
- {
- Point where;
- ControlHandle whichControl;
- short partCode;
- Boolean extendSel;
-
- if (whichWindow != FrontWindow ()) {
- SelectWindow (whichWindow);
- } else {
- where = gTheEvent.where;
- GlobalToLocal (&where);
-
- partCode = FindControl (where, whichWindow, &whichControl);
-
- if (whichControl == NULL) {
- extendSel = ((gTheEvent.modifiers & shiftKey) != 0);
- if ((cur->text != NULL)
- && PtInRect (where, &((**(cur->text)).viewRect))) {
- TEClick (where, extendSel, cur->text);
- } else {
- MouseInContent (where, gTheEvent.modifiers);
- }
- } else {
- if ((whichControl == cur->vScroll)
- || (whichControl == cur->hScroll)) {
- TrackScroll (whichControl, partCode, where, &ScrollWindow);
- } else {
- DoControl (whichControl, partCode, where); /* dispatcher.c */
- }
- }
- }
- } /*DoContent*/
-
- /*----------*/
- void DoDrag (WindowPtr whichWindow)
- {
- RgnHandle grayRgn;
- Rect limitRect;
-
- grayRgn = GetGrayRgn ();
- limitRect = (**grayRgn).rgnBBox;
- DragWindow (whichWindow, gTheEvent.where, &limitRect);
- } /*DoDrag*/
-
- /*----------*/
- /*void InvalGrowBox (WindowPtr whichWindow);*/
- /*void InvalGrowBox (WindowPtr whichWindow)*/
- /*{*/
- /* Rect growBox;*/
- /* */
- /* #define port whichWindow->portRect*/
- /* SetRect (&growBox, port.right - 15, port.bottom - 15,*/
- /* port.right, port.bottom);*/
- /* InvalRect (&growBox);*/
- /* #undef port*/
- /*}*/ /*InvalGrowBox*/
-
- /*----------*/
- /*void DoGrow (WindowPtr whichWindow)*/
- /*{*/
- /* #define minWidth 55 */
- /* #define minHeight 55 */
- /* #define maxint 32767 */
- /**/
- /* RgnHandle grayRgn;*/
- /* short maxWidth;*/
- /* short maxHeight;*/
- /* Rect sizeRect;*/
- /* long newSize;*/
- /* short newWidth;*/
- /* short newHeight;*/
- /* */
- /* grayRgn = GetGrayRgn ();*/
- /* sizeRect = (**grayRgn).rgnBBox;*/
- /* maxWidth = (sizeRect.right - sizeRect.left);*/
- /* maxHeight = (sizeRect.bottom - sizeRect.top) - GetMBarHeight ();*/
- /**/
- /* SetRect (&sizeRect, minWidth, minHeight, maxint, maxint);*/
- /* newSize = GrowWindow (whichWindow, curEvent.where, &sizeRect);*/
- /* if (newSize != 0) {*/
- /* InvalGrowBox (whichWindow); /* old position »*/
- /* newWidth = LoWord (newSize);*/
- /* newHeight = HiWord (newSize);*/
- /* SizeWindow (whichWindow, newWidth, newHeight, true);*/
- /* ResizeContent ();*/
- /* ResizeScrollBars ();*/
- /* InvalGrowBox (whichWindow); /* new position »*/
- /* }*/
- /*}*/ /*DoGrow*/
-
- /*----------*/
- void DoGoAway (WindowPtr whichWindow,EventRecord gTheEvent)
- {
- if (TrackGoAway (whichWindow, /*curEvent.where*/gTheEvent.where)) {
- DoClose ();
- }
- } /*DoGoAway*/
-
- /*----------*/
- /*void SetZoomRect (WindowPtr whichWindow,*/
- /* short inOrOut);*/
- /*void SetZoomRect (WindowPtr whichWindow,*/
- /* short inOrOut)*/
- /*{*/
- /* Rect windRect;*/
- /* Rect theSect;*/
- /* Rect zoomRect;*/
- /* Rect gdRect;*/
- /* GDHandle nthDevice;*/
- /* GDHandle dominantGDevice;*/
- /* long sectArea;*/
- /* long greatestArea;*/
- /* short bias;*/
- /* Boolean sectFlag;*/
- /* GrafPtr savePort;*/
- /**/
- /* if (TrackBox (whichWindow, curEvent.where, inOrOut)) {*/
- /* GetPort (&savePort);*/
- /* SetPort (whichWindow);*/
- /* EraseRect (&whichWindow->portRect);*/
- /* windRect = whichWindow->portRect;*/
- /* LocalToGlobal (&topLeft (windRect));*/
- /* LocalToGlobal (&botRight (windRect));*/
- /* bias = windRect.top - 1 - (**(((WindowPeek) whichWindow)->strucRgn)).rgnBBox.top;*/
- /* windRect.top = windRect.top - bias;*/
- /* nthDevice = GetDeviceList ();*/
- /* greatestArea = 0;*/
- /**/
- /* while (nthDevice != NULL) {*/
- /* if (TestDeviceAttribute (nthDevice, screenDevice)) {*/
- /* if (TestDeviceAttribute (nthDevice, screenActive)) {*/
- /* gdRect = (**nthDevice).gdRect;*/
- /* sectFlag = SectRect (&windRect, &gdRect, &theSect);*/
- /* sectArea = ((long) (theSect.right - theSect.left))*/
- /* * (theSect.bottom - theSect.top);*/
- /* if (sectArea > greatestArea) {*/
- /* greatestArea = sectArea;*/
- /* dominantGDevice = nthDevice;*/
- /* }*/
- /* nthDevice = GetNextDevice (nthDevice);*/
- /* }*/
- /* }*/
- /* } /*while»*/
- /**/
- /* if (dominantGDevice == GetMainDevice ()) {*/
- /* bias = bias + GetMBarHeight ();*/
- /* }*/
- /* gdRect = (**dominantGDevice).gdRect;*/
- /* SetRect (&zoomRect, gdRect.left + 3, gdRect.top + bias + 3, gdRect.right - 3, gdRect.bottom - 3);*/
- /* (**(WStateDataHandle) (((WindowPeek) whichWindow)->dataHandle)).stdState = zoomRect;*/
- /* }*/
- /*}*/ /*SetZoomRect*/
-
- /*----------*/
- /*void DoZoom (WindowPtr whichWindow,*/
- /* short inOrOut)*/
- /*{*/
- /* if (TrackBox (whichWindow, curEvent.where, inOrOut)) {*/
- /* EraseRect (&whichWindow->portRect);*/
- /* if ((inOrOut == inZoomOut) && sysConfig.hasColorQD) {*/
- /* SetZoomRect (whichWindow, inOrOut);*/
- /* }*/
- /* ZoomWindow (whichWindow, inOrOut, false);*/
- /* InvalRect (&whichWindow->portRect);*/
- /* ResizeContent ();*/
- /* ResizeScrollBars ();*/
- /* }*/
- /*}*/ /*DoZoom*/
-
- /* Windowing */
-